

<script src="/statics/custom/img_upload/jquery-migrate-1.2.1.min.js"></script>
<link href="/statics/custom/img_upload/IMGUP.css" rel="stylesheet">


<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="关闭">
        <span aria-hidden="true">×</span>
    </button>
    <h4 class="modal-title" id="exampleModalTabs">添加跟进记录</h4>
</div>
<div class="modal-body">
    <form class="form-horizontal">
        <div class="tab-content">
            {% csrf_token %}
            <div class="tab-pane active" id="exampleLine1" role="tabpanel">
                <div class="form-group hidden">
                    <label class="col-md-2 control-label" for="client_id">ID</label>
                    <div class="col-md-8">
                        <input type="text" class="form-control input-md" id="client_id" name="client_id" value="{{ o_id }}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-2 control-label" for="content">跟进内容</label>
                    <div class="col-md-8">
                        <textarea class="form-control" id="content" name="content" placeholder="请输入跟进内容"></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">跟进记录截图</label>
                    <div class="col-md-8">
                        <div id="div_imglook">
                            <div style="clear: both;"></div>
                            <div id="div_imgfile">选择图片</div>
                        </div>

                        <input class="hidden" type="button" value="确定上传" id="btn_ImgUpStart">
                    </div>
                </div>

            </div>

        </div>
    </form>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-success" id="button_client_info_save">添加</button>
</div>


<script src="/statics/custom/img_upload/IMGUP.js"></script>
<script>
    (function ($) {
        $("#button_client_info_save").on('click', function () {
            var img_urls = "";
            $("#div_imglook .lookimg").each(function () {
                var img_url = $(this).children('img').attr('src');
                img_urls += img_url + '|'
            });
            var url = "/follow_records/create/0/";
            var data = $(".form-horizontal").serialize() + "&img_urls=" + img_urls;

            $.post(url, data, function (result) {
                if(!result['status']){
                    toastr['error'](result['message']);

                }else{
                    toastr['success'](result['message']);

                    setTimeout(function () {
                        location.reload()
                    }, 1000);
                }
            }, 'json')

        })
    })(jQuery)
</script>

